package cn.hrlly.tao2shou.presenter;

import cn.hrlly.tao2shou.biz.ApplicationDetailsBiz;
import cn.hrlly.tao2shou.biz.ApplicationDetailsBizImpl;
import cn.hrlly.tao2shou.domain.Application;
import cn.hrlly.tao2shou.listener.OnApplicationDetailsListener;
import cn.hrlly.tao2shou.view.view_interface.ApplicationDetailsView;

/**
 * User: gengliang
 * Date: 2016-01-31
 * Time: 11:52
 */

public class ApplicationDetailsPresenterImpl implements ApplicationDetailsPresenter,OnApplicationDetailsListener {

    private ApplicationDetailsBiz applicationDetailsBiz;
    private ApplicationDetailsView applicationDetailsView;

    public ApplicationDetailsPresenterImpl(ApplicationDetailsView applicationDetailsView){
        this.applicationDetailsBiz=new ApplicationDetailsBizImpl(this);
        this.applicationDetailsView=applicationDetailsView;
    }

    @Override
    public void showApplicationDetails() {
        Application application=new Application();
        application.setApplicationId(applicationDetailsView.getApplicationId());
        applicationDetailsBiz.getApplicationDetails(application);
    }

    @Override
    public void showApplicationDetailsSucc(Application application) {
        applicationDetailsView.showApplicationDetail(application);
    }

    @Override
    public void showApplicationDetailsFail(String errorMessage) {
        applicationDetailsView.showMessage(errorMessage);
    }

    @Override
    public void showApplicationDetailsFail(int errorMessage) {
        applicationDetailsView.showMessage(errorMessage);
    }
}
